﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <script src="../scripts/boot.js" type="text/javascript"></script>
    <script src="../scripts/kindeditor/kindeditor-min.js" type="text/javascript"></script>
    <script src="../scripts/kindeditor/lang/zh_CN.js" type="text/javascript"></script>
    <link href="../scripts/kindeditor/themes/default/default.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript">
        $.ajax({
            url: "../data/system.aspx?method=401",
            async: false,
            success: function (text) {
                if (text == "no")
                    window.location = "../system/error.html";
                else if (text == "out") {
                    var loginWindow = parent.mini.get("loginWindow");
                    if (!loginWindow.visible)
                        loginWindow.show();
                    var tabs = parent.mini.get("mainTabs");
                    var tab = tabs.getTab("tab$401");
                    tabs.removeTab(tab);
                }
            }
        });

        var States = [{ id: 0, text: '显示' }, { id: 1, text: '隐藏' }, { id: -1, text: '全部'}];
        var State = [{ id: 0, text: '显示' }, { id: 1, text: '隐藏'}];
        var StateShow = [{ id: 0, text: '<font color="Green">显示</font>' }, { id: 1, text: '<font color="Red">隐藏</font>'}];
        var Type = [{ id: 1, text: '组团招聘' }, { id: 2, text: '周六人才集市'}];
    </script>
</head>
<body>
	<div class="mini-toolbar" style="border-bottom: 0;">
        <table>
            <tr>
                <td style="white-space: nowrap;">
                    招聘会名称:
                    <input class="mini-textbox" id="key" emptytext="关键字" />
                    类型：
                    <input id="type" class="mini-combobox" style="width: 100px;" data="Type" value="1" />
                    状态：
                    <input id="state" class="mini-combobox" style="width: 60px;" data="States" value="0" />
                    <a class="mini-button" iconcls="icon-search" plain="true" onclick="search()">查询</a>
                </td>
            </tr>
            <tr>
                <td>
                    <a class="mini-button" iconcls="icon-add" plain="true" onclick="addRow();">新增</a>
                    <a class="mini-button" iconcls="icon-remove" plain="true" onclick="delRows()">删除</a>
                    <span class="separator"></span>
                    <a class="mini-button" iconcls="icon-tip" plain="true" onclick="enterRows(1);">可报名</a>
                    <a class="mini-button" iconcls="icon-undo" plain="true" onclick="enterRows(0)">取消</a>
                    <span class="separator"></span>
                    <a class="mini-button" iconcls="icon-unlock" plain="true" onclick="lockRows(0);">显示</a>
                    <a class="mini-button" iconcls="icon-lock" plain="true" onclick="lockRows(1)">隐藏</a>
                    <span class="separator"></span>
<!--                    <a class="mini-button" iconcls="icon-upload" plain="true" onclick="topRows(1);">置顶</a>
                    <a class="mini-button" iconcls="icon-undo" plain="true" onclick="topRows(0)">取消</a>
                    <span class="separator"></span>-->
                    <a class="mini-button" iconcls="icon-tip" plain="true" onclick="redRows(1);">描红</a>
                    <a class="mini-button" iconcls="icon-undo" plain="true" onclick="redRows(0)">取消</a>
                    <span class="separator"></span>
                    <a class="mini-button" iconcls="icon-reload" plain="true" onclick="refreshRows(1);">刷新</a>
                    <a class="mini-button" iconcls="icon-undo" plain="true" onclick="refreshRows(0)">取消</a>
                </td>
            </tr>
        </table>
    </div>
    <div class="mini-fit">
        <div id="datagrid1" class="mini-datagrid" style="width:100%;height:100%;" allowresize="true"
            idfield="id" multiselect="true" url="../data/system.aspx?method=GetFairList" sizeList="[15,20,50,100]" pageSize="15">
            <div property="columns">
                <div type="checkcolumn" ></div>  
                <div cellCls="actionIcons" name="action" width="60px" headerAlign="center" align="center" renderer="onActionRenderer" cellStyle="padding:0;">操作</div>
                <div field="jf_name" headerAlign="center" align="center" allowSort="true" renderer="onNameRenderer">招聘会名称</div>
                <div field="jf_type" width="100px" headeralign="center" align="center" allowsort="true" renderer="onTypeRenderer">类型</div>
                <div field="jf_time" width="80px" headerAlign="center" align="center" allowSort="true" dateFormat="yyyy-MM-dd">举办日期</div>
                <div field="jf_filecount" width="70px" headeralign="center" align="center" renderer="onFileRenderer">上传文件数</div>
                <div field="jf_hits" width="100px" headeralign="center" align="center" allowsort="true">点击数</div>
                <div field="jf_enter" width="80px" headerAlign="center" align="center" allowSort="true" renderer="onEnterRenderer">报名</div>
                <div field="jf_count" width="80px" align="center" allowSort="true" headerAlign="center" renderer="onCompanyRenderer">报名单位数</div>
                <div field="jf_hide" width="50px" headeralign="center" align="center" allowsort="true" renderer="onStateRenderer">状态</div>
                <div field="jf_inserttime" width="80px" headerAlign="center" align="center" allowSort="true" dateFormat="yyyy-MM-dd">添加时间</div>
                <div field="jf_insertip" width="70px" align="center" headerAlign="center" allowSort="true">添加ip</div>
                <div field="su_login" width="50px" align="center" allowSort="true" headerAlign="center">添加用户</div>
            </div>
        </div>
    </div>
    <div id="editWindow" class="mini-window" title="招聘会信息" style="width: 1050px; height:auto;" showmodal="true"
        allowresize="false" allowdrag="true" showFooter="true">
        <div id="editform" class="form">
            <input class="mini-hidden" name="jf_no" id="jf_no" />
            <table style="width: 100%; height: 100%;">
                <tr style="height: 20px">
                    <td class="tdtitle" style="width: 100px;">
                        <span class="red">*</span>标题：
                    </td>
                    <td class="tdtext">
                        <input name="jf_name" class="mini-textbox" required="true" style="width:450px;"/>&nbsp;&nbsp;
                    </td>
                </tr>
                <tr style="height: 20px">
                    <td class="tdtitle">
                        <span class="red">*</span>类别：
                    </td>
                    <td class="tdtext">
                        <input name="jf_type" class="mini-combobox" style="width:120px;" data="Type" required="true" />&nbsp;&nbsp;
                        <input name="jf_enter" class="mini-checkbox" text="允许报名"/>&nbsp;
                        <input name="jf_hide" class="mini-checkbox" text="隐藏"/>&nbsp;
<!--                        <input name="jf_orderid" class="mini-checkbox" text="置顶"/>&nbsp;-->
                        <input name="jf_red" class="mini-checkbox" text="描红"/>
                    </td>
                </tr>
                <tr style="height: 20px">
                    <td class="tdtitle">
                        <span class="red">*</span>举办时间：
                    </td>
                    <td class="tdtext">
                        <input name="jf_time" class="mini-datepicker" required="true" />
                    </td>
                </tr>
                <tr style="height: 20px">
                    <td class="tdtitle">
                        报名截止日期：
                    </td>
                    <td class="tdtext">
                        <input name="jf_closetime" class="mini-datepicker"/>
                    </td>
                </tr>
                <tr style="height: 20px">
                    <td class="tdtitle">
                        引用地址：
                    </td>
                    <td class="tdtext">
                        <input name="jf_url" class="mini-textbox" vtype="url" style="width:680px;"/>
                    </td>
                </tr>
                <tr style="height: 20px">
                    <td class="tdtitle">
                        <span class="red">*</span>内容：
                    </td>
                    <td class="tdtext">
                        <textarea name="jf_memo" style="width:940px;height:300px;visibility:hidden;"></textarea>
                    </td>
                </tr>
            </table>
        </div>
        <div property="footer" style="text-align:center;padding:5px;">
            <a class="mini-button" style="width:60px;" onclick="updateRow()">保存</a>
            <span style="display:inline-block;width:25px;"></span>
            <a class="mini-button" style="width:60px;" onclick="closewin()">关闭</a>
        </div>
    </div>
    <iframe id="exportIFrame" style="display:none;"></iframe>
    <!--导出Excel相关HTML-->
     <form id="excelForm" action="../data/download.aspx?method=ExcelFair" method="post" target="excelIFrame">
        <input type="hidden" name="id" id="jid" />
    </form>
    <iframe id="excelIFrame" name="excelIFrame" style="display:none;"></iframe>
</body>
<script type="text/javascript">
    $.ajaxSetup({
        contentType: "application/x-www-form-urlencoded;charset=utf-8",
        complete: function (XMLHttpRequest, textStatus) {
            if (XMLHttpRequest.responseText == "out") {
                var loginWindow = parent.mini.get("loginWindow");
                if (!loginWindow.visible)
                    loginWindow.show();
            }
        }
    });

    mini.parse();

    var editor;
    KindEditor.ready(function (K) {
        editor = K.create('textarea[name="jf_memo"]', {
            allowFileManager: true
        });
    });

    var grid = mini.get("datagrid1");
    search();

    function search() {
        var state = mini.get("state").getValue();
        var type = mini.get("type").getValue();
        var key = mini.get("key").getValue();
        grid.load({ key: key, type: type, state: state });
        grid.sortBy("jf_no", "desc");
    }

    function onActionRenderer(e) {
        var s = '<span class="icon-edit actionspan" title="修改" onclick="editRow(' + e.record._uid + ')"></span><span class="separator"></span><span class="icon-remove actionspan" title="删除" onclick="delRow(' + e.record._uid + ')"></span>';
        if (e.record.jf_count > 0)
            s = '<span class="icon-edit actionspan" title="修改" onclick="editRow(' + e.record._uid + ')"></span><span class="separator"></span><span class="icon-remove actionspan" title="删除" onclick="delRow(' + e.record._uid + ')"></span><span class="separator"></span><span class="icon-excel actionspan" title="导出" onclick="excelRow(' + e.record._uid + ')"></span>';
        return s;
    }

    function onNameRenderer(e) {
        var s;
        var record = e.record;
        if (record.jf_red == 1) {
            if (record.jf_url != null && record.jf_url != "")
                s = '<a class="linelink" target="_blank" href="' + record.jf_url + '"><font color="#ff3300">' + record.jf_name + '</font></a>';
            else
                s = '<a class="linelink" target="_blank" href="../../Web/Jobfair/' + record.jf_no + '.html"><font color="#ff3300">' + record.jf_name + '</font></a>';
        }
        else {
            if (record.jf_url != null && record.jf_url != "")
                s = '<a class="linelink" target="_blank" href="' + record.jf_url + '">' + record.jf_name + '</a>';
            else
                s = '<a class="linelink" target="_blank" href="../../Web/Jobfair/' + record.jf_no + '.html">' + record.jf_name + '</a>';
        }
        if (e.record.jf_orderid > 0)
            s = s + '<font color="#0088ff">[顶]</font>';
        if (e.record.jf_hide == 1)
            s = s + '<font color="#ff3300">[隐]</font>';
        return s;
    }

    function onEnterRenderer(e) {
        var date = new Date();
        if (e.value > 0) {
            if (e.record.jf_closetime > date) {
                return '<font color="Blue">允许报名</font>';
            } else {
                return '<font color="Blue">报名已截至</font>';
            }
        } else
            return '<font color="Red">不允许报名</font>';
    }

    function onCompanyRenderer(e) {
        if (e.record.jf_count > 0) {
            var s = '<a class="linelink" title="详细" href="javascript:void(0)" onclick="showCompany(' + e.record._uid + ')">管理</a> (' + e.value + ')';
            return s;
        }
        else
            return e.value;
    }

    function addRow() {
        var form = new mini.Form("#editform");
        form.reset();
        form.loading();
        form.unmask();
        editor.html('');
        var win = mini.get("editWindow");
        win.setTitle("新增招聘会<span class='red'>( 带 * 号的必须填写)</span>");
        if (!win.visible)
            win.show();
    }

    function editRow(row_uid) {
        var row = grid.getRowByUID(row_uid);
        if (row) {
            var win = mini.get("editWindow");
            var form = new mini.Form("#editform");
            form.clear();
            form.loading();
            $.ajax({
                url: "../data/system.aspx?method=GetFair",
                data: { id: row.jf_no },
                success: function (text) {
                    form.unmask();
                    if (text == "out") {
                        win.hide();
                        var loginWindow = parent.mini.get("loginWindow");
                        if (!loginWindow.visible)
                            loginWindow.show();
                        return;
                    }
                    var o = mini.decode(text);
                    form.setData(o);
                    if (o.jf_memo != null)
                        editor.html(o.jf_memo);
                    win.setTitle("编辑招聘会<span class='red'>( 带 * 号的必须填写)</span>");
                    win.show();
                },
                error: function () {
                    form.unmask();
                    ShowMessage("系统提示", "表单加载出错！", 3);
                }
            });
        }
    }

    function updateRow() {
        var content = editor.html();
        if (editor.isEmpty()) {
            ShowMessage("系统提示", "内容不能为空！", 2);
            return;
        }
        var form = new mini.Form("#editform");
        form.validate();
        if (form.isValid() == false)
            return;
        var o = form.getData();
        var json = mini.encode(o);
        //var fireid = $("#fireid").val();
        mini.mask({ el: document.body, cls: 'mini-mask-loading', html: '保存中，请稍后...' });

        $.ajax({
            url: "../data/system.aspx?method=SaveFair",
            data: { data: json, content: content },
            type: "post",
            success: function (ret) {
                mini.unmask(document.body);
                if (ret == "out") {
                    var loginWindow = parent.mini.get("loginWindow");
                    if (!loginWindow.visible)
                        loginWindow.show();
                    return;
                }
                var editWindow = mini.get("editWindow");
                if (ret == 1) {
                    editWindow.hide();
                    ShowMessage("系统提示", "招聘会保存成功！", 1);
                    grid.reload();
                    creatHtml();
                }
                else if (ret == 0) {
                    editWindow.hide();
                    ShowMessage("系统提示", "该招聘会已不存在，请确认！", 2);
                    grid.reload();
                }
                else if (ret == 2) {
                    editWindow.hide();
                    ShowMessage("系统提示", "该招聘会已存在，请确认！", 2);
                    grid.reload();
                }
                else if (ret == 3) {
                    editWindow.hide();
                    ShowMessage("系统提示", "该招聘会已有企业报名，不能再修改！", 2);
                    grid.reload();
                }
                else
                    ShowMessage("系统提示", "招聘会保存失败！", 3);
            },
            error: function (XMLHttpRequest, textStatus, errorThrown) {
                mini.unmask(document.body);
                ShowMessage("系统提示", "招聘会保存失败！", 3);
            }
        });
    }

    function closewin() {
        var win = mini.get("editWindow");
        win.hide();
    }

    function delRow(row_uid) {
        var row = grid.getRowByUID(row_uid);
        if (row) {
            mini.confirm("确定删除此招聘会吗？", "系统提示",
                function (action) {
                    if (action == "ok") {
                        mini.mask({ el: document.body, cls: 'mini-mask-loading', html: '删除中，请稍后...' });
                        $.ajax({
                            url: "../data/system.aspx?method=DeleteFair",
                            type: "post",
                            data: { id: row.jf_no },
                            success: function (ret) {
                                mini.unmask(document.body);
                                if (ret == "out") {
                                    var loginWindow = parent.mini.get("loginWindow");
                                    if (!loginWindow.visible)
                                        loginWindow.show();
                                    return;
                                }
                                if (ret >= 0) {
                                    ShowMessage("系统提示", "招聘会删除成功！", 1);
                                    grid.reload();
                                    creatHtml();
                                }
                                else if (ret == -2) {
                                    ShowMessage("系统提示", "该招聘会已有企业报名，不能删除！", 2);
                                    grid.reload();
                                }
                                else
                                    ShowMessage("系统提示", "招聘会删除失败！", 3);
                            },
                            error: function (XMLHttpRequest, textStatus, errorThrown) {
                                mini.unmask(document.body);
                                ShowMessage("系统提示", "招聘会删除失败！", 3);
                            }
                        });
                    }
                }
            );
        }
    }

    function excelRow(row_uid) {
        var row = grid.getRowByUID(row_uid);
        if (row) {
            mini.confirm("确定导出此招聘会报名情况吗？", "系统提示",
                function (action) {
                    if (action == "ok") {
                        $("#jid").val(row.jf_no);
                        $("#excelForm").submit();
                    }
                }
            );
        }
    }

    function delRows() {
        var rows = grid.getSelecteds();
        if (rows.length > 0) {
            mini.confirm("确定删除所选招聘会信息吗？", "系统提示",
                function (action) {
                    if (action == "ok") {
                        mini.mask({ el: document.body, cls: 'mini-mask-loading', html: '删除中，请稍后...' });
                        var ids = "";
                        for (var i = 0; i < rows.length; i++) {
                            ids += rows[i].jf_no + ',';
                        }

                        $.ajax({
                            url: "../data/system.aspx?method=DeleteFair",
                            type: "post",
                            data: { id: ids },
                            success: function (ret) {
                                mini.unmask(document.body);
                                if (ret == "out") {
                                    var loginWindow = parent.mini.get("loginWindow");
                                    if (!loginWindow.visible)
                                        loginWindow.show();
                                    return;
                                }
                                if (ret >= 0) {
                                    ShowMessage("系统提示", "招聘会删除成功！", 1);
                                    grid.reload();
                                    creatHtml();
                                }
                                else if (ret == -2) {
                                    ShowMessage("系统提示", "所选招聘会已有企业报名，不能删除！", 2);
                                    grid.reload();
                                }
                                else
                                    ShowMessage("系统提示", "招聘会删除失败！", 3);
                            },
                            error: function (XMLHttpRequest, textStatus, errorThrown) {
                                mini.unmask(document.body);
                                ShowMessage("系统提示", "招聘会删除失败！", 3);
                            }
                        });
                    }
                }
            );
        } else
            ShowMessage("系统提示", "请选择需要删除的招聘会！", 2);
    }

    function enterRows(state) {
        var rows = grid.getSelecteds();
        var msg = "允许报名";
        if (state == 0)
            msg = "取消报名";
        if (rows.length > 0) {
            mini.confirm("确定" + msg + "所选招聘会吗？", "系统提示",
                    function (action) {
                        if (action == "ok") {
                            mini.mask({ el: document.body, cls: 'mini-mask-loading', html: '操作中，请稍后...' });
                            var ids = "";
                            for (var i = 0; i < rows.length; i++) {
                                ids += rows[i].jf_no + ',';
                            }

                            $.ajax({
                                url: "../data/system.aspx?method=EnterFair",
                                type: "post",
                                data: { id: ids, state: state },
                                success: function (ret) {
                                    mini.unmask(document.body);
                                    if (ret == "out") {
                                        var loginWindow = parent.mini.get("loginWindow");
                                        if (!loginWindow.visible)
                                            loginWindow.show();
                                        return;
                                    }
                                    if (ret >= 0) {
                                        ShowMessage("系统提示", "招聘会" + msg + "成功！", 1);
                                        grid.reload();
                                    }
                                    else
                                        ShowMessage("系统提示", "招聘会" + msg + "失败！", 3);
                                },
                                error: function (XMLHttpRequest, textStatus, errorThrown) {
                                    mini.unmask(document.body);
                                    ShowMessage("系统提示", "招聘会" + msg + "失败！", 3);
                                }
                            });
                        }
                    }
                );
        } else
            ShowMessage("系统提示", "请选择需要" + msg + "的招聘会！", 2);
    }

    function lockRows(state) {
        var rows = grid.getSelecteds();
        var msg = "隐藏";
        if (state == 0)
            msg = "显示";
        if (rows.length > 0) {
            mini.confirm("确定" + msg + "所选招聘会吗？", "系统提示",
                    function (action) {
                        if (action == "ok") {
                            mini.mask({ el: document.body, cls: 'mini-mask-loading', html: '操作中，请稍后...' });
                            var ids = "";
                            for (var i = 0; i < rows.length; i++) {
                                ids += rows[i].jf_no + ',';
                            }

                            $.ajax({
                                url: "../data/system.aspx?method=LockFair",
                                type: "post",
                                data: { id: ids, state: state },
                                success: function (ret) {
                                    mini.unmask(document.body);
                                    if (ret == "out") {
                                        var loginWindow = parent.mini.get("loginWindow");
                                        if (!loginWindow.visible)
                                            loginWindow.show();
                                        return;
                                    }
                                    if (ret >= 0) {
                                        ShowMessage("系统提示", "招聘会" + msg + "成功！", 1);
                                        grid.reload();
                                        creatHtml();
                                    }
                                    else
                                        ShowMessage("系统提示", "招聘会" + msg + "失败！", 3);
                                },
                                error: function (XMLHttpRequest, textStatus, errorThrown) {
                                    mini.unmask(document.body);
                                    ShowMessage("系统提示", "招聘会" + msg + "失败！", 3);
                                }
                            });
                        }
                    }
                );
        } else
            ShowMessage("系统提示", "请选择需要" + msg + "的招聘会！", 2);
    }

    function topRows(state) {
        var rows = grid.getSelecteds();
        var msg = "置顶";
        if (state == 0)
            msg = "取消置顶";
        if (rows.length > 0) {
            mini.confirm("确定" + msg + "所选招聘会吗？", "系统提示",
                function (action) {
                    if (action == "ok") {
                        mini.mask({ el: document.body, cls: 'mini-mask-loading', html: '操作中，请稍后...' });
                        var ids = "";
                        for (var i = 0; i < rows.length; i++) {
                            ids += rows[i].jf_no + ',';
                        }

                        $.ajax({
                            url: "../data/system.aspx?method=TopFair",
                            type: "post",
                            data: { id: ids, state: state },
                            success: function (ret) {
                                mini.unmask(document.body);
                                if (ret == "out") {
                                    var loginWindow = parent.mini.get("loginWindow");
                                    if (!loginWindow.visible)
                                        loginWindow.show();
                                    return;
                                }
                                if (ret >= 0) {
                                    ShowMessage("系统提示", "招聘会" + msg + "成功！", 1);
                                    grid.reload();
                                    creatHtml();
                                }
                                else
                                    ShowMessage("系统提示", "招聘会" + msg + "失败！", 3);
                            },
                            error: function (XMLHttpRequest, textStatus, errorThrown) {
                                mini.unmask(document.body);
                                ShowMessage("系统提示", "招聘会" + msg + "失败！", 3);
                            }
                        });
                    }
                }
            );
        }
        else
            ShowMessage("系统提示", "请选择需要" + msg + "的招聘会！", 2);
    }

    function redRows(state) {
        var rows = grid.getSelecteds();
        var msg = "描红";
        if (state == 0)
            msg = "取消描红";
        if (rows.length > 0) {
            mini.confirm("确定" + msg + "所选招聘会吗？", "系统提示",
                function (action) {
                    if (action == "ok") {
                        mini.mask({ el: document.body, cls: 'mini-mask-loading', html: '操作中，请稍后...' });
                        var ids = "";
                        for (var i = 0; i < rows.length; i++) {
                            ids += rows[i].jf_no + ',';
                        }

                        $.ajax({
                            url: "../data/system.aspx?method=RedFair",
                            type: "post",
                            data: { id: ids, state: state },
                            success: function (ret) {
                                mini.unmask(document.body);
                                if (ret == "out") {
                                    var loginWindow = parent.mini.get("loginWindow");
                                    if (!loginWindow.visible)
                                        loginWindow.show();
                                    return;
                                }
                                if (ret >= 0) {
                                    ShowMessage("系统提示", "招聘会" + msg + "成功！", 1);
                                    grid.reload();
                                    creatHtml();
                                }
                                else
                                    ShowMessage("系统提示", "招聘会" + msg + "失败！", 3);
                            },
                            error: function (XMLHttpRequest, textStatus, errorThrown) {
                                mini.unmask(document.body);
                                ShowMessage("系统提示", "招聘会" + msg + "失败！", 3);
                            }
                        });
                    }
                }
            );
        }
        else
            ShowMessage("系统提示", "请选择需要" + msg + "的招聘会！", 2);
    }

    function refreshRows(state) {
        var rows = grid.getSelecteds();
        var msg = "刷新";
        if (state == 0)
            msg = "取消刷新";
        if (rows.length > 0) {
            mini.confirm("确定" + msg + "所选招聘会？", "系统提示",
                    function (action) {
                        if (action == "ok") {
                            mini.mask({ el: document.body, cls: 'mini-mask-loading', html: '操作中，请稍后...' });
                            var ids = "";
                            for (var i = 0; i < rows.length; i++) {
                                ids += rows[i].jf_no + ',';
                            }

                            $.ajax({
                                url: "../data/system.aspx?method=RefreshFair",
                                type: "post",
                                data: { id: ids, state: state },
                                success: function (ret) {
                                    mini.unmask(document.body);
                                    if (ret == "out") {
                                        var loginWindow = parent.mini.get("loginWindow");
                                        if (!loginWindow.visible)
                                            loginWindow.show();
                                        return;
                                    }
                                    if (ret >= 0) {
                                        ShowMessage("系统提示", "招聘会" + msg + "成功！", 1);
                                        grid.reload();
                                        creatHtml();
                                    }
                                    else
                                        ShowMessage("系统提示", "招聘会" + msg + "失败！", 3);
                                },
                                error: function (XMLHttpRequest, textStatus, errorThrown) {
                                    mini.unmask(document.body);
                                    ShowMessage("系统提示", "招聘会" + msg + "失败！", 3);
                                }
                            });
                        }
                    }
                );
        }
        else
            ShowMessage("系统提示", "请选择需要" + msg + "的招聘会！", 2);
    }

    function showCompany(row_uid) {
        var row = grid.getRowByUID(row_uid);
        if (row) {
            var tabs = parent.mini.get("mainTabs");
            var tab = tabs.getTab("tab$401");
            tab.enabled = false;
            showTab(row.jf_no);
        }
    }

    function showTab(jf_no) {
        var tabs = parent.mini.get("mainTabs");
        var id = "tab$com";
        var tab = tabs.getTab(id);
        if (!tab) {
            tab = {};
            tab.name = id;
            tab.title = "报名单位管理";
            tab.showCloseButton = true;
            tab.url = "jobfair/company.html?jfno=" + jf_no;
            tabs.addTab(tab);
        }
        tabs.activeTab(tab);
    }

    function creatHtml() {
        mini.confirm("是否生成首页静态页面？", "系统提示",
                function (action) {
                    if (action == "ok") {
                        mini.mask({ el: document.body, cls: 'mini-mask-loading', html: '生成中，请稍后...' });
                        $.ajax({
                            url: "../data/system.aspx?method=CreateHtml",
                            type: "post",
                            data: { webset: webset },
                            success: function (ret) {
                                mini.unmask(document.body);
                                if (ret == "out") {
                                    var loginWindow = parent.mini.get("loginWindow");
                                    if (!loginWindow.visible)
                                        loginWindow.show();
                                    return;
                                }
                                if (ret == 1) {
                                    ShowMessage("系统提示", "静态页面生成成功！", 1);
                                }
                                else
                                    ShowMessage("系统提示", "静态页面生成失败！", 3);
                            },
                            error: function (XMLHttpRequest, textStatus, errorThrown) {
                                mini.unmask(document.body);
                                ShowMessage("系统提示", "静态页面生成失败！", 3);
                            }
                        });
                    }
                }
            );
        }

        //上传文件数显示
        function onFileRenderer(e) {
            var s = e.value;
            if (e.value != null && e.value > 0)
                s = '<a class="linelink" title="详细" href="javascript:void(0);" onclick="fileRows(' + e.record._uid + ')">查看</a> (' + e.value + ')';
            return s;
        }

        //上传文件管理
        function fileRows(row_uid) {
            var row = grid.getRowByUID(row_uid);
            if (row) {
                var tabs = parent.mini.get("mainTabs");
                var tab = tabs.getTab("tab$401");
                tab.enabled = false;
                showPTab(row.jf_no);
            }
        }

        //打开上传文件管理Tab
        function showPTab(jf_no) {
            var tabs = parent.mini.get("mainTabs");
            var id = "tab$files" + jf_no;
            var tab = tabs.getTab(id);
            if (!tab) {
                tab = {};
                tab.name = id;
                tab.title = "上传文件查看";
                tab.showCloseButton = true;
                tab.url = "jobfair/file.html?jfno=" + jf_no;
                tabs.addTab(tab);
            }
            tabs.activeTab(tab);
        }
</script>
</html>
